#include <iostream>
#include <memory>

class Product {
public:
    virtual void operation() = 0;
    virtual ~Product() {}
};

class ConcreteProductA : public Product {
public:
    void operation() override {
        std::cout << "Operation of ConcreteProductA" << std::endl;
    }
};

class ConcreteProductB : public Product {
public:
    void operation() override {
        std::cout << "Operation of ConcreteProductB" << std::endl;
    }
};

class Factory {
public:
    static std::unique_ptr<Product> createProduct(const std::string& type) {
        if (type == "A") {
            return std::make_unique<ConcreteProductA>();
        } else if (type == "B") {
            return std::make_unique<ConcreteProductB>();
        }
        return nullptr;
    }
};

int main() {
    auto productA = Factory::createProduct("A");
    productA->operation();

    auto productB = Factory::createProduct("B");
    productB->operation();

    return 0;
}